//
//  HMButton.m
//  Chongtai
//
//  Created by Mac book on 16/3/25.
//  Copyright © 2016年 Mac book. All rights reserved.
//

#import "HMButton.h"

@implementation HMButton


+ (UIButton *)createButtonWithTitle:(NSString *)title andTitleColor:(UIColor*)titleColor andBgColor:(UIColor*)color andImage:(UIImage *)image  andBgImage:(UIImage *)bgImage andSelecter:(SEL)sel andTarget:(id)target andTag:(NSInteger)tag;
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];


    if (title) {
        [btn setTitle:title forState:UIControlStateNormal];
    }
    if (titleColor) {
        [btn setTitleColor:titleColor forState:UIControlStateNormal];
    }
    if (color) {
        btn.backgroundColor = color;
    }
    if (image) {
        [btn setImage:image forState:UIControlStateNormal];
    }
    if (bgImage) {
        [btn setBackgroundImage:bgImage forState:UIControlStateNormal];
    }
    if (sel) {
        [btn addTarget:target action:sel forControlEvents:UIControlEventTouchUpInside];
    }
    if (tag) {
        btn.tag = tag;
    }
    return btn;
    
}


@end
